package com.wyd.common.bean;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
@ApiModel("通用接口返回包装")
public class ResultMy<T> {
    @ApiModelProperty("返回码")
    private String code;

    @ApiModelProperty("消息")
    private String msg;

    @ApiModelProperty("数据")
    private T data;

    public ResultMy(String code, String msg, T data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public static <T> ResultMy<T> build(String code, String msg, T data) {
        return new ResultMy<>(code, msg, data);
    }
}
